package com.utrailer.wlt.order.service.impl;

import com.utrailer.wlt.order.entity.OrderEntity;
import com.utrailer.wlt.order.model.vo.OrderVO;
import com.utrailer.wlt.order.service.OrderService;
import com.utrailer.wlt.order.service.feign.FeignVehicleService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * TODO
 *
 * @author Chen Song
 * @since
 */
@Service
@Log4j2
public class OrderServiceImpl implements OrderService {

    @Autowired
    private FeignVehicleService feignVehicleService;

    @Override
    public List<OrderEntity> list(OrderVO vo) {
        if (vo.getOrderId() == null) {
            feignVehicleService.getById(2L);
        } else if (vo.getOrderId() % 2 == 0) {
            throw new RuntimeException("cause by order");
        } else {
            feignVehicleService.getById(1L);
        }
        return Collections.emptyList();
    }
}
